/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.androidpublisher.model;

/**
 * A ProductPurchaseV2 resource indicates the status of a user's inapp product purchase.
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Google Play Android Developer API. For a detailed
 * explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class ProductPurchaseV2 extends com.google.api.client.json.GenericJson {

  /**
   * Output only. The acknowledgement state of the purchase.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String acknowledgementState;

  /**
   * This kind represents a ProductPurchaseV2 object in the androidpublisher service.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String kind;

  /**
   * An obfuscated version of the id that is uniquely associated with the user's account in your
   * app. Only present if specified using https://developer.android.com/reference/com/android/billin
   * gclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String obfuscatedExternalAccountId;

  /**
   * An obfuscated version of the id that is uniquely associated with the user's profile in your
   * app. Only present if specified using https://developer.android.com/reference/com/android/billin
   * gclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String obfuscatedExternalProfileId;

  /**
   * The order id associated with the purchase of the inapp product. May not be set if there is no
   * order associated with the purchase.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String orderId;

  /**
   * Contains item-level info for a ProductPurchaseV2.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<ProductLineItem> productLineItem;

  static {
    // hack to force ProGuard to consider ProductLineItem used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(ProductLineItem.class);
  }

  /**
   * The time when the purchase was successful, i.e., when the PurchaseState has changed to
   * PURCHASED. This field will not be present until the payment is complete. For example, if the
   * user initiated a pending transaction
   * (https://developer.android.com/google/play/billing/integrate#pending), this field will not be
   * populated until the user successfully completes the steps required to complete the transaction.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String purchaseCompletionTime;

  /**
   * Information about the purchase state of the purchase.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private PurchaseStateContext purchaseStateContext;

  /**
   * ISO 3166-1 alpha-2 billing region code of the user at the time the product was granted.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String regionCode;

  /**
   * Information related to test purchases. This will only be set for test purchases.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private TestPurchaseContext testPurchaseContext;

  /**
   * Output only. The acknowledgement state of the purchase.
   * @return value or {@code null} for none
   */
  public java.lang.String getAcknowledgementState() {
    return acknowledgementState;
  }

  /**
   * Output only. The acknowledgement state of the purchase.
   * @param acknowledgementState acknowledgementState or {@code null} for none
   */
  public ProductPurchaseV2 setAcknowledgementState(java.lang.String acknowledgementState) {
    this.acknowledgementState = acknowledgementState;
    return this;
  }

  /**
   * This kind represents a ProductPurchaseV2 object in the androidpublisher service.
   * @return value or {@code null} for none
   */
  public java.lang.String getKind() {
    return kind;
  }

  /**
   * This kind represents a ProductPurchaseV2 object in the androidpublisher service.
   * @param kind kind or {@code null} for none
   */
  public ProductPurchaseV2 setKind(java.lang.String kind) {
    this.kind = kind;
    return this;
  }

  /**
   * An obfuscated version of the id that is uniquely associated with the user's account in your
   * app. Only present if specified using https://developer.android.com/reference/com/android/billin
   * gclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made.
   * @return value or {@code null} for none
   */
  public java.lang.String getObfuscatedExternalAccountId() {
    return obfuscatedExternalAccountId;
  }

  /**
   * An obfuscated version of the id that is uniquely associated with the user's account in your
   * app. Only present if specified using https://developer.android.com/reference/com/android/billin
   * gclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made.
   * @param obfuscatedExternalAccountId obfuscatedExternalAccountId or {@code null} for none
   */
  public ProductPurchaseV2 setObfuscatedExternalAccountId(java.lang.String obfuscatedExternalAccountId) {
    this.obfuscatedExternalAccountId = obfuscatedExternalAccountId;
    return this;
  }

  /**
   * An obfuscated version of the id that is uniquely associated with the user's profile in your
   * app. Only present if specified using https://developer.android.com/reference/com/android/billin
   * gclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made.
   * @return value or {@code null} for none
   */
  public java.lang.String getObfuscatedExternalProfileId() {
    return obfuscatedExternalProfileId;
  }

  /**
   * An obfuscated version of the id that is uniquely associated with the user's profile in your
   * app. Only present if specified using https://developer.android.com/reference/com/android/billin
   * gclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made.
   * @param obfuscatedExternalProfileId obfuscatedExternalProfileId or {@code null} for none
   */
  public ProductPurchaseV2 setObfuscatedExternalProfileId(java.lang.String obfuscatedExternalProfileId) {
    this.obfuscatedExternalProfileId = obfuscatedExternalProfileId;
    return this;
  }

  /**
   * The order id associated with the purchase of the inapp product. May not be set if there is no
   * order associated with the purchase.
   * @return value or {@code null} for none
   */
  public java.lang.String getOrderId() {
    return orderId;
  }

  /**
   * The order id associated with the purchase of the inapp product. May not be set if there is no
   * order associated with the purchase.
   * @param orderId orderId or {@code null} for none
   */
  public ProductPurchaseV2 setOrderId(java.lang.String orderId) {
    this.orderId = orderId;
    return this;
  }

  /**
   * Contains item-level info for a ProductPurchaseV2.
   * @return value or {@code null} for none
   */
  public java.util.List<ProductLineItem> getProductLineItem() {
    return productLineItem;
  }

  /**
   * Contains item-level info for a ProductPurchaseV2.
   * @param productLineItem productLineItem or {@code null} for none
   */
  public ProductPurchaseV2 setProductLineItem(java.util.List<ProductLineItem> productLineItem) {
    this.productLineItem = productLineItem;
    return this;
  }

  /**
   * The time when the purchase was successful, i.e., when the PurchaseState has changed to
   * PURCHASED. This field will not be present until the payment is complete. For example, if the
   * user initiated a pending transaction
   * (https://developer.android.com/google/play/billing/integrate#pending), this field will not be
   * populated until the user successfully completes the steps required to complete the transaction.
   * @return value or {@code null} for none
   */
  public String getPurchaseCompletionTime() {
    return purchaseCompletionTime;
  }

  /**
   * The time when the purchase was successful, i.e., when the PurchaseState has changed to
   * PURCHASED. This field will not be present until the payment is complete. For example, if the
   * user initiated a pending transaction
   * (https://developer.android.com/google/play/billing/integrate#pending), this field will not be
   * populated until the user successfully completes the steps required to complete the transaction.
   * @param purchaseCompletionTime purchaseCompletionTime or {@code null} for none
   */
  public ProductPurchaseV2 setPurchaseCompletionTime(String purchaseCompletionTime) {
    this.purchaseCompletionTime = purchaseCompletionTime;
    return this;
  }

  /**
   * Information about the purchase state of the purchase.
   * @return value or {@code null} for none
   */
  public PurchaseStateContext getPurchaseStateContext() {
    return purchaseStateContext;
  }

  /**
   * Information about the purchase state of the purchase.
   * @param purchaseStateContext purchaseStateContext or {@code null} for none
   */
  public ProductPurchaseV2 setPurchaseStateContext(PurchaseStateContext purchaseStateContext) {
    this.purchaseStateContext = purchaseStateContext;
    return this;
  }

  /**
   * ISO 3166-1 alpha-2 billing region code of the user at the time the product was granted.
   * @return value or {@code null} for none
   */
  public java.lang.String getRegionCode() {
    return regionCode;
  }

  /**
   * ISO 3166-1 alpha-2 billing region code of the user at the time the product was granted.
   * @param regionCode regionCode or {@code null} for none
   */
  public ProductPurchaseV2 setRegionCode(java.lang.String regionCode) {
    this.regionCode = regionCode;
    return this;
  }

  /**
   * Information related to test purchases. This will only be set for test purchases.
   * @return value or {@code null} for none
   */
  public TestPurchaseContext getTestPurchaseContext() {
    return testPurchaseContext;
  }

  /**
   * Information related to test purchases. This will only be set for test purchases.
   * @param testPurchaseContext testPurchaseContext or {@code null} for none
   */
  public ProductPurchaseV2 setTestPurchaseContext(TestPurchaseContext testPurchaseContext) {
    this.testPurchaseContext = testPurchaseContext;
    return this;
  }

  @Override
  public ProductPurchaseV2 set(String fieldName, Object value) {
    return (ProductPurchaseV2) super.set(fieldName, value);
  }

  @Override
  public ProductPurchaseV2 clone() {
    return (ProductPurchaseV2) super.clone();
  }

}
